// 横杠命名转化为驼峰命名

// 先将第一个字母转为大写
type FirstCaseUpperCase<T> = T extends `${infer L}${infer R}` ? `${Uppercase<L>}${R}` : T;

type A = FirstCaseUpperCase<'Ttrtr'>  // Ttrtr

// 将分隔符后的字母转为大写, 将最后一个不含分隔符的首字母转为大写;

// 方式一
type CamelCase1<T> = T extends `${infer L}-${infer R}` ? `${FirstCaseUpperCase<L>}${CamelCase<R>}` : FirstCaseUpperCase<T>;


// 方式二
export type CamelCase<T extends string, Prev extends string = ''> =
    T extends `${infer L}-${infer R1}${infer R2}` ?
    CamelCase<R2, `${Prev}${L}${Uppercase<R1>}`> : Capitalize<`${Prev}${T}`>;


type a1 = CamelCase<"handle-open-flag-xxx">; // HandleOpenFlag
type a2 = CamelCase<"open-flag">; // OpenFlag

export { }